package com.android.mg.tabsswipe;

import java.util.ArrayList;
import java.util.HashMap;

import com.android.mg.beans.Paraderos;
import com.android.mg.tgaazul.R;
import com.android.mg.db.DBAdapter;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

public class UpParaderosFragment extends Fragment {

	final String[] from = { "nombre" };
	final int[] to = new int[] { R.id.nombre_paradero};
	
	DBAdapter dbAdapter;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		
		View rootView = inflater.inflate(R.layout.fragment_paraderos_tab_1, container,false);
		
//		ArrayList<Paraderos> paraderos = dbAdapter.getAllParaderos();
		
	/*	ArrayList<HashMap<String, String>> HParaderos = new ArrayList<HashMap<String,String>>();
		for(Paraderos paradero : paraderos){
			HashMap<String, String> paraderoData = new HashMap<String, String>();
			
			paraderoData.put(from[0], paradero.getNombre());
			
			HParaderos.add(paraderoData);
		}
		*/
	//	SimpleAdapter listAdapter = new SimpleAdapter(getActivity(), HParaderos, R.layout.fragment_list_all_paraderos,from, to);
		
		
		String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
		        "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
		        "Linux", "OS/2" };
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),R.layout.fragment_list_all_paraderos,R.id.nombre_paradero,values);

		   
		((ListView) rootView.findViewById(R.id.listparaderos)).setAdapter(adapter);
		
		
		Toast.makeText(getActivity(), "Iniciando Fragmento Listado Todos los Paraderos", Toast.LENGTH_LONG);
		return rootView;
	}

	
}
